﻿<Window x:Class="Demos.Spanning_Trees.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Spanning Trees" Height="600" Width="550" Name="view"
        xmlns:local="clr-namespace:Demos.Spanning_Trees">

    <DockPanel>
        <Grid DockPanel.Dock="Bottom" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Button Grid.Column="0" Margin="5" Command="{Binding VerSolucionCommand}">Ver Solucion</Button>
            <Button Grid.Column="1" Margin="5"  Command="{Binding ResolverCommand}">Resolver</Button>
            <Button Grid.Column="2" Margin="5" Command="{Binding AvanzarCommand}">Step</Button>
            <Button Grid.Column="3" Margin="5" Command="{Binding PararCommand}">Parar</Button>
            
            <StackPanel Grid.Row="1" Grid.ColumnSpan="4" HorizontalAlignment="Center" Orientation="Horizontal" Margin="5">
                <RadioButton IsChecked="{Binding SeleccionAlgoritmos[0]}">Baruvka</RadioButton>
                <RadioButton IsChecked="{Binding SeleccionAlgoritmos[1]}"
                             Margin="20,0,0,0">Kruskal</RadioButton>
                <RadioButton IsChecked="{Binding SeleccionAlgoritmos[2]}"
                             Margin="20,0,0,0">Prim</RadioButton>
            </StackPanel>
            
            <Separator Grid.Row="2" Grid.ColumnSpan="4" Margin="10"></Separator>

            <Label Grid.Row="3">Baruvka:</Label>
            <TextBox IsReadOnly="True" Grid.Row="3" Margin="60,5,5,5"
                     Text="{Binding Tiempos[0]}"></TextBox>

            <Label Grid.Row="3" Grid.Column="1" Margin="10,0,0,0">Kruskal:</Label>
            <TextBox IsReadOnly="True" Grid.Row="3" Grid.Column="1" Margin="60,5,5,5"
                     Text="{Binding Tiempos[1]}"></TextBox>

            <Label Grid.Row="3" Grid.Column="2" Margin="20,0,0,0">Prim:</Label>
            <TextBox IsReadOnly="True" Grid.Row="3" Grid.Column="2" Margin="60,5,5,5"
                     Text="{Binding Tiempos[2]}"></TextBox>
            
            <Button Grid.Row="3" Grid.Column="3" Margin="5" 
                    Command="{Binding MedirTiemposCommand}">Medir Tiempos</Button>
        </Grid>

        <local:ArbolUserControl 
            ContenidoVisual="{Binding Arbol, UpdateSourceTrigger=PropertyChanged}"
            DataContext="{Binding ElementName=view, Path=DataContext}"/>
    </DockPanel>
</Window>
